package com.origin.src.import0;


import com.origin.src.ApplicationTool;
import com.origin.src.import0.selector.XImportSelector;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportAware;
import org.springframework.core.type.AnnotationMetadata;

import java.util.Arrays;

@Import({XImportSelector.class})
public class XImportApplicationContext implements ImportAware {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(XImportApplicationContext.class);
        ApplicationTool.printBean(applicationContext);


    }


    @Override
    public void setImportMetadata(AnnotationMetadata importMetadata) {
        System.out.println("ImportAware这个注入了AnnotationMetadata:" + Arrays.toString(importMetadata.getAnnotationTypes().toArray()));
    }
}
